package com.uzai.console.service.reportpanel.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.console.annotation.DataPanel;
import com.uzai.console.dto.remoteapi.DataPanelRemoteQuery;
import com.uzai.console.dto.reportpanel.DataPanelQueryDto;
import com.uzai.console.dto.reportpanel.ReportPanelQuery;
import com.uzai.console.enums.ReportPanelTypeEnum;
import com.uzai.console.service.reportpanel.BaseDataPanelService;
import com.uzai.console.service.reportpanel.DataPanelService;
import com.uzai.console.service.reportpanel.ReportPanelFansValueService;
import com.uzai.console.vo.reportpanel.DataPanelVo;
import com.uzai.console.vo.reportpanel.ReportPanelFansValueVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;

/**
 * @author mingyang.chen create in 2023/3/29 11:30
 */
@DataPanel
@Slf4j
public class FansCountDataPanelServiceImpl extends BaseDataPanelService implements DataPanelService {

    @Autowired
    private ReportPanelFansValueService reportPanelFansValueService;

    @Override
    public ReportPanelTypeEnum getDataPanelType() {
        return ReportPanelTypeEnum.FANS_VALUE;
    }

    @Override
    public Class<? extends DataPanelVo> childDataPanelVoClass() {
        return ReportPanelFansValueVo.class;
    }

    @Override
    public Page<? extends DataPanelVo> pageDataPanel(DataPanelQueryDto queryDto) {
        ReportPanelQuery reportPanelQuery = new ReportPanelQuery();
        BeanUtils.copyProperties(queryDto, reportPanelQuery);
        reportPanelQuery.setType(ReportPanelTypeEnum.FANS_VALUE.getId());
        return reportPanelFansValueService.findReportPanelFansValueByPage(reportPanelQuery);
    }

    @Override
    public HashMap<String, String> showFieldList() {
        return new HashMap<>();
    }

    @Override
    public Object checkAndBuildRemoteParam(DataPanelRemoteQuery query) {
        // 暂时未用到, 无需实现
        return null;
    }

    @Override
    public Object remoteDataQuery(DataPanelRemoteQuery query) {
        // 暂时未用到, 无需实现
        return null;
    }
}
